<template>
  <view class="content">
    <scroll-list ref="scrollList" :scrollFlag="false" @getData="getData">
      <template v-slot="{ item, index }">
        <view class="item" @click="$util.goUrl('../careDispose/index')">
          <view class="left">
            <view>内容</view>
            <view>时间</view>
          </view>
          <view :class="[index < 3 ? 'active' : '']"
            >{{ index < 3 ? "待" : "已" }}处理<text class="iconfont icon-right" />
          </view>
        </view>
      </template>
    </scroll-list>
  </view>
</template>

<script>
import scrollList from "@/components/scroll-list/scroll-list.vue";
export default {
  components: { scrollList },
  data() {
    return {
      token: uni.getStorageSync("token"),
      current: 0,
      initFlag: false,
    };
  },
  onShareAppMessage() {
    return this.$util.returnShareObj();
  },
  onLoad(options) {
    this.$nextTick(() => {
      this.$refs.scrollList.getData(1);
    });
  },
  onPullDownRefresh() {
    this.$refs.scrollList.getData(2);
  },
  onReachBottom() {
    this.$refs.scrollList.getData(3);
  },
  methods: {
    init() {
      if (this.initFlag) {
        return;
      }
      this.initFlag = true;
      this.$refs.scrollList.getData(1);
    },
    getData(param) {
      setTimeout(() => {
        let list = [];
        for (let i = 0; i < 20; i++) {
          list.push(i);
        }
        this.$refs.scrollList.setData(param.pageNo == 2 ? false : list, false);
      }, 2000);
    },
    patientData() {
      uni.showActionSheet({
        itemList: ["患者档案", "测量数据"],
        success: (res) => {
          if (res.tapIndex == 1) {
            this.$util.goUrl("/pagesPatient/metricalData/index");
          } else {
            this.$util.goUrl("/pagesPatient/record/index");
          }
        },
      });
    },
    goDetails(item) {
      this.$util.goUrl("/pagesPatient/record/index");
    },
    goMetrical(item) {
      this.$util.goUrl("/pagesPatient/metricalData/index");
    },
  },
};
</script>
<style lang="scss" scoped>
.content {
  min-height: 100vh;
  background: $back-grey-color;
}
.item {
  width: 100vw;
  background: #fff;
  border-bottom: 1rpx solid $default-border-color;
  padding: 20rpx 20rpx 20rpx 40rpx;
  box-sizing: border-box;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: $font-grey-color;
  .left {
    width: 60vw;
    view:first-child {
      overflow: hidden; // 溢出部分隐藏
      white-space: nowrap; // 文字不换行
      text-overflow: ellipsis; // 显示省略号
      margin-bottom: 10rpx;
      color: $default-color;
    }
    view:last-child {
      font-size: $small-font-size;
    }
  }
  .active {
    color: $theme-color;
  }
}
.item::after {
  content: "";
  position: absolute;
  height: 1rpx;
  width: 40rpx;
  background: #fff;
  left: 0;
  bottom: 0;
}
</style>
